<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <p>双向数据绑定</p>
        <p>{{str}}</p>
        <button @click="clickHandler">点击</button>
        <input type="text" @input="inputHandler" :value="str">
        <p>{{info}}</p>

        <input type="text" v-model="info">
    </div>
    <!-- react diff算法 -->
    <script src="./node_modules/vue/dist/vue.global.js"></script>
    <script>
        const {createApp} = Vue;
        createApp({
            data(){
                return {
                    str:'hello world',
                    info:''
                }
            },
            methods:{
                clickHandler(){
                    this.str = '修改后'
                },
                inputHandler(e){
                    this.str = e.target.value
                }
            }
        }).mount('#app')
    </script>
</body>
</html>